<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>

	<title>Editar Cliente</title>
</h:head>
<h:body>
	<ui:composition template="template/Layout.xhtml">
		<ui:define name="content">
			<h:form id="form">

				<p:growl id="messages" showDetail="true" />
				
				<br/>
				<p:dataTable id="tabela" var="item" value="#{clienteMB.lista}" editable="true" style="width:90%; padding-left: 80px">

					<f:facet name="header">Lista de Clientes</f:facet>

					<p:ajax event="rowEdit" listener="#{clienteMB.onEdit}"
						update=":form:messages" process="@this" />
					<p:ajax event="rowEditCancel" listener="#{clienteMB.onCancel}"
						update=":form:messages" process="@this" />
						


					<p:column headerText="Nome" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.nome}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.nome}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="RG" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.rg}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.rg}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="CPF" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.cpf}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.cpf}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Data de Nascimento" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.datanascimento}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.datanascimento}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Email" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.email}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.email}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Endereço" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.endereco}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.endereco}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="CEP" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.cep}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.cep}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Bairro" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.bairro}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.bairro}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Cidade" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.cidade}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.cidade}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Estado" style="width:30%">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{item.estado}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText value="#{item.estado}" style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					

					<p:column style="width:6%">
						<p:rowEditor />
					</p:column>

				</p:dataTable>

			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>